/**
 * 
 */
package com.hexacta.hrs.repositories.impl;

import java.util.Collection;

import org.hibernate.Criteria;

import com.hexacta.hrs.securitygroups.Permission;

/**
 * @author mtestasecca
 * @author rmilano
 * 
 */
public class PermissionsRecordObjectRepository extends HibernateRecordObjectRepository<Permission> {

    /** {@inheritDoc} */
    public PermissionsRecordObjectRepository(Class<Permission> entityClass) {
        super(entityClass);
    }

    /** {@inheritDoc} */
    @SuppressWarnings("unchecked")
    @Override
    public Collection<Permission> matching(Permission criteria) {
        Criteria crit = getSession().createCriteria(Permission.class);

        // Se lo agrega para que solo traiga una sola instacia del securityGroup.
        crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

        // Se devuelven los filtros.
        return crit.list();
    }
}